﻿using Corina.Commands;
using Corina.Common;
using Corina.Datamodel.DataObject;
using Corina.Datamodel.Entities;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Ink;
using System.Windows.Input;

namespace Corina.Cydee.Apphub.Viewmodels
{
    public class ProfileViewmodel : ViewmodelBase
    {
        public ProfileViewmodel() { 
            if(DataContext.IsValid)
            {
                UpdateEntity = DataContext.CurrentAccount;
            }
        }

        private ManagerInfo _updateEntity = new ManagerInfo();
        public ManagerInfo UpdateEntity
        {
            get { return _updateEntity; }
            set
            {
                _updateEntity = value;
                RaisePropertyChanged(() => UpdateEntity);
            }
        }

        #region Commands
        public ICommand SubmitCommand
        {
            get
            {
                return new GenericCommand()
                {
                    ExecuteCallback = delegate {
                        ManagerClient.UpdateProfileAsync(Account, Password, UpdateEntity.Name, UpdateEntity.Mobile, UpdateEntity.Email);
                    }
                };
            }
        }
        #endregion
    }
}
